package cn.inbot.shopadmin.module.mine.repository;

import android.os.Build;

import java.util.HashMap;

import cn.inbot.shopadmin.api.DemoApiFactory;
import cn.inbot.shopadmin.app.AppConfig;
import cn.inbot.shopadmin.bean.LoginResult;
import cn.inbot.shopadmin.util.Base64Util;
import cn.inbot.lib.util.LocalUtil;
import io.reactivex.Observable;

/**
 * Created by shisenkun on 2021/5/11.
 */
public class LoginRepository {

    public Observable<LoginResult> login(String username, String password, String androidId) {
        HashMap<String, String> parameters = new HashMap();
        parameters.put("ca", "86");
        parameters.put("pn", username);
        parameters.put("p", Base64Util.stringToBase64(password));
        parameters.put("at", AppConfig.APP_TYPE);
        parameters.put("av", AppConfig.APP_VERSION);
        parameters.put("lg", LocalUtil.getCurrentLanguage());
        parameters.put("d", Build.MODEL);
        parameters.put("ra", AppConfig.REGISTER_APP);
        parameters.put("t", androidId);

        return DemoApiFactory.getInstance().getDemoApi().login(parameters);

    }

}
